home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2003 December / The Sunday Times - The Month 2003-12.iso / mac / The Month DEC 03 / engine / modules / preview_nofade.swf / scripts / frame_1 / DoAction.as
Text File  |  2003-09-05  |  2KB  |  91 lines

  1. function loadImage(mc, node, extrapath)
  2. {
  3.    extrapath != null ? 0 : (extrapath = "");
  4.    var strDefaultPath = Tardis.ASSETS_FOLDER + "images/" + Tardis.ActiveSection.id + "/";
  5.    var strImg = node.getText();
  6.    var diffpath = node.attributes.path;
  7.    if(diffpath != null)
  8.    {
  9.       strImg = diffpath + strImg;
  10.    }
  11.    else
  12.    {
  13.       strImg = strDefaultPath + extrapath + strImg;
  14.    }
  15.    strPathPrefix != null ? 0 : (strPathPrefix = "");
  16.    mc.loadMovie(strPathPrefix + strImg);
  17. }
  18. function init()
  19. {
  20.    nmCurrentImage = 0;
  21.    PREVIEW_PATH = nodeData.attributes.imagepath;
  22.    var mc_image;
  23.    var mc_file;
  24.    var strFile;
  25.    len = nmImagesTotal = nodeData.childNodes.length;
  26.    var n = 0;
  27.    while(n < len)
  28.    {
  29.       mc_image = this.createEmptyMovieClip("mc_image_" + n,++depth);
  30.       mc_image._visible = false;
  31.       mc_file = mc_image.createEmptyMovieClip("mc_file",++depth);
  32.       strFile = nodeData.childNodes[n].byName("image").getText();
  33.       mc_file.onLoad = fileLoaded;
  34.       loadImage(mc_file,nodeData.childNodes[n].byName("image"),PREVIEW_PATH);
  35.       n++;
  36.    }
  37.    mc_image = this.createEmptyMovieClip("mc_image_" + len,++depth);
  38.    mc_image._visible = false;
  39.    mc_file = mc_image.createEmptyMovieClip("mc_file",++depth);
  40.    mc_file.onLoad = fileLoaded;
  41.    nmCurrentImage = len;
  42.    loadImage(mc_file,_parent.ndDefault.byName("image"),PREVIEW_PATH);
  43. }
  44. function exit()
  45. {
  46.    delete mc_front;
  47.    delete mc_back;
  48.    this.removeAllMovieClips();
  49. }
  50. function doOver(num)
  51. {
  52.    default_image = this["mc_image_" + len];
  53.    default_image._visible = false;
  54.    showCurrentImage(num);
  55. }
  56. function doOut()
  57. {
  58.    mc_image = this["mc_image_" + len];
  59.    mc_image._visible = true;
  60.    current_image = this["mc_image_" + nmCurrentImage];
  61.    current_image._visible = false;
  62. }
  63. function showCurrentImage(nextnum)
  64. {
  65.    nmCurrentImage = nextnum;
  66.    mc_back = this["mc_image_" + nmCurrentImage];
  67.    mc_back._visible = true;
  68. }
  69. function fileLoaded()
  70. {
  71.    this.onLoad = null;
  72.    nmImagesLoaded++;
  73.    if(nmImagesLoaded == nmImagesTotal)
  74.    {
  75.       allImagesLoaded();
  76.    }
  77. }
  78. function allImagesLoaded()
  79. {
  80.    this["mc_image_" + len]._visible = true;
  81.    onComplete();
  82. }
  83. nmImagesLoaded = 0;
  84. depth = 0;
  85. this.onReady();
  86. this.onUnload = function()
  87. {
  88.    clearFadeDelay();
  89.    mc_front.onEnterFrame = null;
  90. };
  91.